package com.xcity.game.battle;

@Deprecated
public abstract class AbstractBattler implements Battler {

	protected BattleContext context;
	protected int hp, maxHp;
	protected int attack;
	
	public AbstractBattler() {}
	
	public AbstractBattler(int initHp, int initAttack) {
		this.hp = maxHp = initHp;
		this.attack = initAttack;
	}
	
	@Override
	public void init(BattleContext context) {
		this.context = context;
	}

	@Override
	public int getHp() {
		return hp;
	}

	@Override
	public void setHp(int hp) {
		this.hp = hp < 0 ? 0 : (hp > maxHp ? maxHp : hp);
	}

	@Override
	public int getMaxHp() {
		return maxHp;
	}

	@Override
	public int getAttack() {
		return attack;
	}

	@Override
	public void setAttack(int attack) {
		this.attack = attack;
	}

	@Override
	public BattleContext getContext() {
		return context;
	}
	
}
